package com.jiangwz.sort;

import java.util.Arrays;
import java.util.Random;

/**
 * @author jiangwz
 * @create 2021/3/17.
 */
public class BaseSort {

    public static boolean checkSort(int[] source, int[] arr) {
        Arrays.sort(source);
        boolean same = true;
        for (int i = 0; i < source.length; i++) {
            if (source[i] != arr[i]) same = false;
        }
        return same;
    }

    public static int[] randomArray(int count) {
        int[] arr = new int[count];
        Random random = new Random();
        for (int i = 0; i < count; i++) {
            arr[i] = random.nextInt(100000);
        }
        return arr;
    }

    public static void swap(int[] arr, int i, int j) {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }

    public static void print(int[] arr) {
        System.out.println(Arrays.toString(arr));
    }
}
